package com.xiaochun.jiankangapp.dialog

import android.os.Bundle
import android.view.ViewGroup
import androidx.appcompat.app.AppCompatDialog
import com.xiaochun.jiankangapp.activity.SendReportActivity
import com.xiaochun.jiankangapp.databinding.DialogChooseGalleryBinding
import com.xiaochun.jiankangapp.extension.onClick

class ChooseGalleryDialog(private val activity: SendReportActivity) : AppCompatDialog(activity) {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val viewBinding = DialogChooseGalleryBinding.inflate(
            layoutInflater,
            window?.decorView as ViewGroup?, false
        )
        window?.decorView?.setBackgroundDrawable(null)
        setContentView(viewBinding.root)
        viewBinding.gallery.onClick {
            activity.pictureSelector()
            dismiss()
        }
        viewBinding.camera.onClick {
            activity.openCamera()
            dismiss()
        }
    }
}